#ifndef ___Win32Timer_H___
#define ___Win32Timer_H___

//#ifndef WIN32_LEAN_AND_MEAN
//#  define WIN32_LEAN_AND_MEAN
//#endif
#include <windows.h>
#include <time.h>

#define FREQUENCY_RESAMPLE_RATE 200

namespace MyCommon
{
	class Timer
	{
	private:
		clock_t zeroClock;

		DWORD mStartTick;
		LONGLONG mLastTime;
		LARGE_INTEGER mStartTime;
		LARGE_INTEGER mFrequency;

		DWORD mProcMask;
		DWORD mSysMask;

		HANDLE mThread;

		DWORD mQueryCount;
	public:
		Timer();
		~Timer();

		/** Resets timer */
		void reset();

		/** Returns milliseconds since initialization or last reset */
		unsigned long getMilliseconds();

		/** Returns microseconds since initialization or last reset */
		unsigned long getMicroseconds();

		/** Returns milliseconds since initialization or last reset, only CPU time measured */	
		unsigned long getMillisecondsCPU();

		/** Returns microseconds since initialization or last reset, only CPU time measured */	
		unsigned long getMicrosecondsCPU();
	};
}

#endif